package com.zlt.dao;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import com.zlt.entity.ChatMessageDetail;
import com.zlt.entity.ChatMessageMain;
import com.zlt.vo.ChatVo;


public interface ChatMessageDao {

    List<ChatVo> showSeekerChatList(String username);

    List<ChatVo> showRecruiterChatList(String username);

    /**
     * 在聊天消息主表中插入信息
     *
     * @param thisUUID
     * @param uuid
     * @return 影响的行数
     */
    int insertMainByParams(UUID thisUUID, UUID uuid);

    int insertMainByClass(ChatMessageMain chatMessageMain);

    int insertDetailByParams(int mainId, String thisUUID, String userUid, Character type, Object content, Date date, Character hasRead);

    int insertDetailByClass(ChatMessageDetail chartMessageDetail);

    /**
     * 存在该记录
     *
     * @param src
     * @param dest
     * @return
     */
    ChatMessageMain isExist(String src, String dest);

    /**
     * 插入记录并返回id值
     *
     * @param src
     * @param dest
     * @return
     */
    Integer insertRecord(String src, String dest);

    /**
     * 添加消息详情 <br/>
     * 默认是文本类型
     *
     * @param mainId  消息列表id
     * @param uid     发送者id
     * @param to      接受者id
     * @param content 内容
     * @param hasRead 读取状态
     * @return
     */
    Integer insertDetailByParams(Integer mainId, String uid, String to, String content, Character hasRead) throws SQLException;

    /**
     * 查询聊天对象列表
     *
     * @param uid
     * @return
     */
    List<ChatMessageMain> selectChatList(String uid) throws SQLException;

    /**
     * 获取聊天记录
     *
     * @param src
     * @param dest
     * @return
     */
    List<ChatMessageDetail> selectChatDetail(String src, String dest) throws SQLException;

    Integer addMain(String user1, String user2,String cid, String jid);

    List<ChatMessageDetail> showChats(String phone1, String phone);

    Integer getMain(String uid1, String uid2);
}
